Skip to content

[PLUGIN-1960] Add SMBv2/v3 support to WindowsShareCopy with legacy SMBv1 fallback - #1997

Merged
vikasrathee-cs merged 1 commit into
cdapio:developfrom
cloudsufi:smbj-migration-windows-share-copy
Jul 29, 2026
Merged

[PLUGIN-1960] Add SMBv2/v3 support to WindowsShareCopy with legacy SMBv1 fallback#1997
vikasrathee-cs merged 1 commit into
cdapio:developfrom
cloudsufi:smbj-migration-windows-share-copy

Conversation

@vishwasvaidya-cloudsufi

@vishwasvaidya-cloudsufi vishwasvaidya-cloudsufi commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Kept the legacy jcifs (SMBv1) library to maintain backward compatibility. The plugin dynamically routes to either SMBv1 or SMBv2/v3, defaulting to the newer protocol for all new pipelines.

Key Changes:

  • Backward Compatibility / UI: Added an SMB Protocol Version dropdown to the UI. New pipelines default to SMBv2/v3. Crucially, if the configuration receives a null value (which happens when existing pipelines are upgraded), the plugin safely falls back to SMBv1 to prevent pipeline breakage.

  • Dependency Management: Retained jcifs and added smbj along with its explicitly required transitive dependencies (mbassador, asn-one, bcprov) to the pom.xml to ensure CDAP classloader compatibility.

  • Modern SMB Architecture: Implemented a secure, hierarchical connection lifecycle (Client -> Session -> Share) for the new smbj execution path.

  • Path Normalization: Added logic to convert UNIX-style forward slashes (/) to Windows-native backslashes () for the smbj share traversal.

  • Directory Traversal: Implemented explicit directory vs. file traversal logic for SMBv2/v3, including filtering for Windows system pointer directories (. and ..).

  • Safe File Operations: Applied AccessMask.GENERIC_READ during smbj file operations to prevent accidental file locking on the destination Windows server.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the legacy jcifs library with smbj in the WindowsShareCopy plugin to support SMBv2 and SMBv3 protocols. This involves updating dependencies in pom.xml and refactoring WindowsShareCopy.java to use SMBClient, Connection, Session, and DiskShare for file operations. The review feedback highlights a resource leak where SMBClient and Session are not properly closed, and suggests using try-with-resources to ensure proper cleanup.

Comment thread core-plugins/src/main/java/io/cdap/plugin/batch/action/WindowsShareCopy.java Outdated
@vikasrathee-cs vikasrathee-cs changed the title Migrate WindowsShareCopy from jcifs to smbj for SMBv2/v3 support [PLUGIN-1960] Migrate WindowsShareCopy from jcifs to smbj for SMBv2/v3 support Jul 20, 2026
@vishwasvaidya-cloudsufi vishwasvaidya-cloudsufi changed the title [PLUGIN-1960] Migrate WindowsShareCopy from jcifs to smbj for SMBv2/v3 support [PLUGIN-1960] Add SMBv2/v3 support to WindowsShareCopy with legacy SMBv1 fallback Jul 24, 2026
Comment thread core-plugins/src/main/java/io/cdap/plugin/batch/action/WindowsShareCopy.java Outdated
Comment thread core-plugins/pom.xml
Comment thread core-plugins/pom.xml
Comment thread core-plugins/src/main/java/io/cdap/plugin/batch/action/WindowsShareCopy.java Outdated
@vishwasvaidya-cloudsufi
vishwasvaidya-cloudsufi force-pushed the smbj-migration-windows-share-copy branch from 5ce492e to 80fd312 Compare July 27, 2026 08:06
@vikasrathee-cs vikasrathee-cs added the build Trigger unit test build label Jul 27, 2026
Comment thread core-plugins/src/main/java/io/cdap/plugin/batch/action/WindowsShareCopy.java Outdated
@vishwasvaidya-cloudsufi
vishwasvaidya-cloudsufi force-pushed the smbj-migration-windows-share-copy branch 2 times, most recently from 80bf655 to 6ce7b0d Compare July 28, 2026 04:46
@vishwasvaidya-cloudsufi
vishwasvaidya-cloudsufi force-pushed the smbj-migration-windows-share-copy branch from d37b541 to 1d559d5 Compare July 29, 2026 04:47
@vikasrathee-cs
vikasrathee-cs merged commit a563b0a into cdapio:develop Jul 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Trigger unit test build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants